' Generated: frame F of creature K into tile Tl, in all three thirds
sub SetFrame:
  Dst16 = Tl
  Dst16 <<= 3
  for J = 0 to 2
    if K = 0 then
      if F = 0 then
        copy Fr0_0 count 8 to vram.pattern + Dst16
      end if
      if F = 1 then
        copy Fr0_1 count 8 to vram.pattern + Dst16
      end if
    end if
    if K = 1 then
      if F = 0 then
        copy Fr1_0 count 8 to vram.pattern + Dst16
      end if
      if F = 1 then
        copy Fr1_1 count 8 to vram.pattern + Dst16
      end if
    end if
    if K = 2 then
      if F = 0 then
        copy Fr2_0 count 8 to vram.pattern + Dst16
      end if
      if F = 1 then
        copy Fr2_1 count 8 to vram.pattern + Dst16
      end if
      if F = 2 then
        copy Fr2_2 count 8 to vram.pattern + Dst16
      end if
    end if
    if K = 3 then
      if F = 0 then
        copy Fr3_0 count 8 to vram.pattern + Dst16
      end if
      if F = 1 then
        copy Fr3_1 count 8 to vram.pattern + Dst16
      end if
      if F = 2 then
        copy Fr3_2 count 8 to vram.pattern + Dst16
      end if
    end if
    if K = 4 then
      if F = 0 then
        copy Fr4_0 count 8 to vram.pattern + Dst16
      end if
      if F = 1 then
        copy Fr4_1 count 8 to vram.pattern + Dst16
      end if
    end if
    if K = 5 then
      if F = 0 then
        copy Fr5_0 count 8 to vram.pattern + Dst16
      end if
      if F = 1 then
        copy Fr5_1 count 8 to vram.pattern + Dst16
      end if
    end if
    if K = 6 then
      if F = 0 then
        copy Fr6_0 count 8 to vram.pattern + Dst16
      end if
      if F = 1 then
        copy Fr6_1 count 8 to vram.pattern + Dst16
      end if
    end if
    if K = 7 then
      if F = 0 then
        copy Fr7_0 count 8 to vram.pattern + Dst16
      end if
      if F = 1 then
        copy Fr7_1 count 8 to vram.pattern + Dst16
      end if
    end if
    Dst16 += 2048
  next
  return
end sub
